import axios, { url } from '.';
const  inquire= async (data) => {
    let res = await axios({
        method: "get",
        url: url + "/commodity/",
        params:data
    })
    return res.data;
};
const commodityAdd = async (data) => {
    let res = await axios({
        method: "post",
        url: url + "/commodity/",
       data
    })
    return res.data;
};
const commodityDelete = async (id) => {
    let res = await axios({
        method: "delete",
        url: url + "/commodity/"+ id,
    })
    return res.data;
};
// 修改查询
export const update = async (id) =>{
    console.log(id);
    let res = await axios({
        method:"get",
        url: url + '/commodity/'+ id,
    });
    return res.data;
}

// 修改
export const set = async (data) =>{
    console.log(data);
    let res = await axios({
        method:"put",
        url: url + '/commodity/'+ data._id,
        data:data
    });
    return res.data;
}
export {
    inquire,commodityAdd,commodityDelete
}